//
//  iPodLibraryExampleViewController.m
//  iPodLibraryExample
//

#import "iPodLibraryExampleViewController.h"

@implementation iPodLibraryExampleViewController

- (void)mediaPicker:(MPMediaPickerController *)mediaPicker
  didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection {
	[self dismissModalViewControllerAnimated:YES];
}

- (void)mediaPickerDidCancel:(MPMediaPickerController *)mediaPicker {
	[self dismissModalViewControllerAnimated:YES];
}

- (void)mediaPickerAction:(id)sender {
	MPMediaPickerController *picker = [[MPMediaPickerController alloc]
									   initWithMediaTypes:MPMediaTypeAny];
	picker.delegate = self;
	picker.allowsPickingMultipleItems = YES;
	picker.prompt = @"Please select";
	[self presentModalViewController:picker animated:YES];
	[picker release];
}

- (void)viewDidLoad {
    [super viewDidLoad];
	
	UIButton *btnMedia = [UIButton buttonWithType:UIButtonTypeRoundedRect];
	[btnMedia setFrame:CGRectMake(230.0,410.0,80.0,34.0)];
	[btnMedia setTitle:@"Media" forState:UIControlStateNormal];
	[btnMedia addTarget:self action:@selector(mediaPickerAction:)
	   forControlEvents:UIControlEventTouchUpInside];
	[self.view addSubview:btnMedia];
}

- (void)dealloc {
    [super dealloc];
}

@end
